
/**
 * 实现C 标准库中的strcpy()函数
*/

#include <iostream>

using namespace std;

char *mstrcpy(char *dest, const char *src)
{
    if(dest == NULL || src == NULL)
        return NULL;
    char *temp = dest;
    while((*temp++ = *src++) != '\0');

    return dest;
}


int main(){
    char buff[30];

    const char *str1 = "HelloWorld!";
    const char *str2 = "Helloworld!";

    cout << mstrcpy(buff,str1) << endl;
    cout << mstrcpy(buff,str2) << endl;

    return 0;
}